﻿using System;
using System.Collections.Generic;
using System.Text;
using SlimDX.Direct3D11;

namespace ParticlesEngine.Core
{
    public class Scene :IDisposable
    {
        internal DeviceContext context;
        internal Device device;
        List<GraphicComponent> components = new List<GraphicComponent>();

        public Scene()
        {
        }

        public void Draw()
        {
            foreach (GraphicComponent component in components)
            {
                component.Draw();
            }
        }

        public void Update()
        {
            foreach (GraphicComponent component in components)
            {
                component.Update();
            }
        }

        public void AddComponent(GraphicComponent component)
        {
            component.device = this.device;
            component.context = this.context;
            components.Add(component);
            component.Initialize();
        }

        public void Dispose()
        {
            foreach (GraphicComponent component in components)
            {
                component.Dispose();
            }
        }

    }
}
